/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.intec.matsab.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Sabrina
 */
@Embeddable
public class ClasePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "idAsignatura")
    private String idAsignatura;
    @Basic(optional = false)
    @Column(name = "idTrimestre")
    private int idTrimestre;
    @Basic(optional = false)
    @Column(name = "numero")
    private int numero;
    @Basic(optional = false)
    @Column(name = "idClase")
    private int idClase;

    public ClasePK() {
    }

    public ClasePK(String idAsignatura, int idTrimestre, int numero, int idClase) {
        this.idAsignatura = idAsignatura;
        this.idTrimestre = idTrimestre;
        this.numero = numero;
        this.idClase = idClase;
    }

    public String getIdAsignatura() {
        return idAsignatura;
    }

    public void setIdAsignatura(String idAsignatura) {
        this.idAsignatura = idAsignatura;
    }

    public int getIdTrimestre() {
        return idTrimestre;
    }

    public void setIdTrimestre(int idTrimestre) {
        this.idTrimestre = idTrimestre;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public int getIdClase() {
        return idClase;
    }

    public void setIdClase(int idClase) {
        this.idClase = idClase;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAsignatura != null ? idAsignatura.hashCode() : 0);
        hash += (int) idTrimestre;
        hash += (int) numero;
        hash += (int) idClase;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClasePK)) {
            return false;
        }
        ClasePK other = (ClasePK) object;
        if ((this.idAsignatura == null && other.idAsignatura != null) || (this.idAsignatura != null && !this.idAsignatura.equals(other.idAsignatura))) {
            return false;
        }
        if (this.idTrimestre != other.idTrimestre) {
            return false;
        }
        if (this.numero != other.numero) {
            return false;
        }
        if (this.idClase != other.idClase) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.intec.matsab.persistence.ClasePK[idAsignatura=" + idAsignatura + ", idTrimestre=" + idTrimestre + ", numero=" + numero + ", idClase=" + idClase + "]";
    }

}
